package com.java.advance.aop.dynamicproxy;

import com.java.advance.aop.IUserDao;
import com.java.advance.aop.UserDaoImpl;

/**
 * 测试动态代理的方法
 * Created by yangminghua on 2019/4/4.
 */
public class TestDynamicProxy {


    public static void main(String[] args) {
        //目标对象
        IUserDao target = new UserDaoImpl();
        System.out.println("目标对象：" + target.getClass().getName());
        //代理对象
        IUserDao proxyInstance = (IUserDao) new ProxyFactory(target).getProxyInstance();
        System.out.println("代理对象：" + proxyInstance.getClass().getName());


        proxyInstance.save();

        proxyInstance.findById(10L);
    }
}
